package models;

import java.util.UUID;

import javax.persistence.*;
import play.db.jpa.Model;

@Entity
public class Invite extends Model {
	@ManyToOne
	public Person invitee;
	
	@ManyToOne
	public Appointment appointment;
	
	@OneToOne
	public MealOrder order;
	
	public String uuid;
	
	public Invite(Person invitee, Appointment appointment, MealOrder order) {
		super();
		this.invitee = invitee;
		this.appointment = appointment;
		this.order = order;
		this.uuid = UUID.randomUUID().toString();
	}
	
	public Invite(Person invitee, Appointment appointment) {
		super();
		this.invitee = invitee;
		this.appointment = appointment;
		this.order = new MealOrder();
		this.order.save();
		this.uuid = UUID.randomUUID().toString();
	}
}
